home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Source / Sieve / SIEVEATL / SIEVEATL.CPP < prev    next >
C/C++ Source or Header  |  1996-10-29  |  2KB  |  80 lines

  1. // SieveATL.cpp : Implementation of DLL Exports.
  2.  
  3. // You will need the NT SUR Beta 2 SDK or VC 4.2 in order to build this 
  4. // project.  This is because you will need MIDL 3.00.15 or higher and new
  5. // headers and libs.  If you have VC 4.2 installed, then everything should
  6. // already be configured correctly.
  7.  
  8. // Note: Proxy/Stub Information
  9. //        To build a separate proxy/stub DLL, 
  10. //        run nmake -f ShortCutSvrps.mak in the project directory.
  11.  
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "initguid.h"
  15. #include "SieveATL.h"
  16. #include "Sieve.h"
  17.  
  18. #define IID_DEFINED
  19. #include "SieveATL_i.c"
  20.  
  21. //These are declared in stdafx.h
  22. // const IID LIBID_SIEVEATLLib = { 0x18315ee2, 0xb8d4, 0x11cf, { 0xae, 0xc1, 0x44, 0x45, 0x53, 0x54, 0, 0 } };
  23. // const CLSID CLSID_CSieveATL = { 0x18315ee7, 0xb8d4, 0x11cf, { 0xae, 0xc1, 0x44, 0x45, 0x53, 0x54, 0, 0 } };
  24.  
  25. CComModule _Module;
  26.  
  27. BEGIN_OBJECT_MAP(ObjectMap)
  28.     OBJECT_ENTRY(CLSID_CSieveATL, CSieveATL)
  29. END_OBJECT_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // DLL Entry Point
  33.  
  34. extern "C"
  35. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  36. {
  37.     if (dwReason == DLL_PROCESS_ATTACH)
  38.     {
  39.         _Module.Init(ObjectMap, hInstance);
  40.         DisableThreadLibraryCalls(hInstance);
  41.     }
  42.     else if (dwReason == DLL_PROCESS_DETACH)
  43.         _Module.Term();
  44.     return TRUE;    // ok
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Used to determine whether the DLL can be unloaded by OLE
  49.  
  50. STDAPI DllCanUnloadNow(void)
  51. {
  52.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  53. }
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // Returns a class factory to create an object of the requested type
  57.  
  58. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  59. {
  60.     return _Module.GetClassObject(rclsid, riid, ppv);
  61. }
  62.  
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllRegisterServer - Adds entries to the system registry
  65.  
  66. STDAPI DllRegisterServer(void)
  67. {
  68.     // registers object, typelib and all interfaces in typelib
  69.     return _Module.RegisterServer(TRUE);
  70. }
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73. // DllUnregisterServer - Adds entries to the system registry
  74.  
  75. STDAPI DllUnregisterServer(void)
  76. {
  77.     _Module.UnregisterServer();
  78.     return S_OK;
  79. }
  80.